#lang sicp

(define (count-change amount)
  
  (define (value k)
    (cond ((= k 1) 1)
          ((= k 2) 5)
          ((= k 3) 10)
          ((= k 4) 25)
          ((= k 5) 50)))
  
  (define (calc amount k)
    (cond ((= amount 0) 1)
          ((or (< amount 0) (> k 5)) 0)
          (else (+ (calc (- amount (value k)) k)
                   (calc amount (+ k 1))))))

  (calc amount 1))

(count-change 10)